package com.example.demo.OtherCoding;

import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-05-15
 * Time: 11:48
 */
public class Code_topKFrequent {
    class Solution {
        public int[] topKFrequent(int[] nums, int k) {
            HashMap<Integer,Integer> map = new HashMap<>();
            //累计词频
            for(int i =0;i<nums.length;++i) {
                map.put(nums[i],map.getOrDefault(0,map.get(nums[i])+1));
            }
            PriorityQueue<Integer> queue = new PriorityQueue<Integer>((o1, o2) -> o1 - o2);
            for(Map.Entry<Integer,Integer> entry : map.entrySet()) {
                queue.offer(entry.getKey());
            }

            int[] res = new int[k];
            return null;
        }
    }

    public static void main(String[] args) {

    }
}
